<?php
/* @var $this SiteController */

$this->pageTitle=Yii::app()->name;

	$count3=0;
	$count1=0;
	$count0=0;
	$countAll=0;
?>
<style type="text/css">
	table{border-collapse: collapse;border: none;}
	td{ border: solid #000 1px; text-align: center;}
	thead th{background-color: #000000;}
	thead th a{color: red}
	tbody tr th a{color: red}
	.mytable th{ text-align: center;}
</style>
<div>
	胜率：<span id="spn3"></span><br/>
	平率：<span id="spn1"></span><br/>
	负率：<span id="spn0"></span><br/>
</div>
<table class="mytable" id="myTable" width="100%">
	<thead>
		<tr style="background-color:#000000; text-align:center; color:white;border-right:1px solid #3E3E3E;border-bottom:1px solid #3E3E3E;line-height:20px;">
			<th align="center">序号</th>
			<th align="center">时间</th>
			<th align="center">赛事</th>
			<th align="center">主队</th>
			<th align="center">比分</th>
			<th align="center">客队</th>
			<th align="center">胜赔</th>
			<th align="center">平赔</th>
			<th align="center">负赔</th>
			<th align="center">赛果</th>
			<th align="center">主队水位</th>
			<th align="center">盘口</th>
			<th align="center">客队水位</th>
			<th align="center">输赢盘</th>
			<th align="center">必发胜<br/>投注量</th>
			<th align="center">必发平<br/>投注量</th>
			<th align="center">必发负<br/>投注量</th>
		</tr>
	</thead>
	<tbody>
	<?
		foreach ($model as $key => $value) {
	?>
	<tr style="background-color:#CCE8CF">
		<td align="center"><?=$value->gameindex?></td>
		<td align="center"><?=date('Y-m-d H:i',strtotime($value->gametime))?></td>
		<td align="center"><?=$value->gametype?></td>
		<td align="center"><?=$value->hometeam?></td>
		<td align="center"><?=$value->homegoal?>:<?=$value->awaygoal?></td>
		<td align="center"><?=$value->awayteam?></td>
		<td align="center"><?=sprintf("%.2f", $value->euroodds3w)?></td>
		<td align="center"><?=sprintf("%.2f", $value->euroodds1w)?></td>
		<td align="center"><?=sprintf("%.2f", $value->euroodds0w)?></td>
		<td align="center">
			<?
				if($value->homegoal!=-1){
					if($value->homegoal>$value->awaygoal){
						printf("<span style='color:red'>%s</span>", "胜");
					}
					else if($value->homegoal==$value->awaygoal){
						printf("<span style='color:black'>%s</span>", "平");
					}
					else if($value->homegoal<$value->awaygoal){
						printf("<span style='color:green'>%s</span>", "负");
					}
				}
			?>
		</td>
		<td align="center"><?=sprintf("%.3f", $value->oddshomemacau)?></td>
		<td align="center"><?=sprintf("%.3f", $value->ratemacau)?></td>
		<td align="center"><?=sprintf("%.3f", $value->oddsawaymacau)?></td>
		<td align="center">
			<?
				if($value->oddshomemacau!=0 && $value->oddsawaymacau!=0){
					if($value->homegoal+$value->ratemacau>$value->awaygoal){
						printf("<span style='color:red'>%s</span>", "赢");
					}
					else if($value->homegoal+$value->ratemacau==$value->awaygoal){
						printf("<span style='color:black'>%s</span>", "走");
					}
					else if($value->homegoal+$value->ratemacau<$value->awaygoal){
						printf("<span style='color:green'>%s</span>", "输");
					}
				}
			?>
		</td>
		<td align="center"><?=number_format(sprintf("%.0f", $value->bfexchange3))?></td>
		<td align="center"><?=number_format(sprintf("%.0f", $value->bfexchange1))?></td>
		<td align="center"><?=number_format(sprintf("%.0f", $value->bfexchange0))?></td>
	</tr>
	<?
		if($value->homegoal!=-1){
			if($value->homegoal>$value->awaygoal){
				$count3++;
			}
			else if($value->homegoal==$value->awaygoal){
				$count1++;
			}
			else if($value->homegoal<$value->awaygoal){
				$count0++;
			}
			$countAll++;
		}
	}
	?>
	</tbody>
</table>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.fixedtableheader.min.js"></script>
<script type="text/javascript">
	$(function () {
        $("#myTable").fixedtableheader({ highlightrow: true, highlightclass: "stab0", headerrowsize: 1 });
        <?if($countAll>0){?>
        $("#spn3").html("<?=sprintf("%.2f", floatval($count3)/floatval($countAll)*100)?>%");
        $("#spn1").html("<?=sprintf("%.2f", floatval($count1)/floatval($countAll)*100)?>%");
        $("#spn0").html("<?=sprintf("%.2f", floatval($count0)/floatval($countAll)*100)?>%");
        <?}?>
    });
</script>